package java_learn.java_jinjie.Recursion;

/**
 * @Author: 李浩然
 * @Date: 2020/12/29 12:48 下午
 */
public class Demo01Recursion {
    public static int plus(int n) {
        if (n == 1) return n;
        else return n + plus(n - 1);

    }

    public static int cheng(int n) {
        if (n == 1 || n == 0) return 1;
        return n * cheng(n - 1);
    }

    public static void main(String[] args) {
        System.out.println(plus(100));
        System.out.println(cheng(5));

    }
}
